<template>
  <view>
    <uni-card class="view-title" :title="title">
      <text class="uni-body view-content">{{ content }}</text>
    </uni-card>
  </view>
</template>

<script>
import { getPrivacyAgreement,getUserAgreement } from "@/api/login";
import UniCard from "@/uni_modules/uni-card/components/uni-card/uni-card.vue";
  export default {
    components: {UniCard},
    data() {
      return {
        title: '',
        content: ''
      }
    },
    created() {
      if(this.$route.query.title == '用户协议'){
        this.getUserAgreement()
      }
      if(this.$route.query.title == '隐私协议'){
        this.getPrivacyAgreement()
      }
    },
    methods: {
      /**
       * 获取页面参数
       */
      getUserAgreement() {
        getUserAgreement().then(res => {
          this.content = res.data
        })
      },
      getPrivacyAgreement() {
        getPrivacyAgreement().then(res => {
          this.content = res.data
        })
      }
    },
    onLoad(options) {
      this.title = options.title
      uni.setNavigationBarTitle({
        title: options.title
      })
    }
  }
</script>

<style scoped>
  page {
    background-color: #ffffff;
  }

  .view-title {
    font-weight: bold;
  }

  .view-content {
    font-size: 26rpx;
    padding: 12px 5px 0;
    color: #333;
    line-height: 24px;
    font-weight: normal;
  }
</style>
